package com.hzqy.persistence.dao.hotel;

import com.hzqy.persistence.dao.core.PersistenceDao;
import com.hzqy.web.vo.HotelCouponCodeVo;
import com.hzqy.web.vo.HotelCouponVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class HotelCouponDao extends PersistenceDao<HotelCouponVo, Integer> {
    protected final Logger LOG = LoggerFactory.getLogger(getClass());
    public int selectYhqCount(HotelCouponVo yhqVo) {
        return getSqlSession().selectOne(this.getNamespace() + "selectYhqCount", yhqVo);
    }
    public List<HotelCouponVo> selectYhq(Map<String, Object> map) {

        return getSqlSession().selectList(this.getNamespace() + "selectYhq", map);
    }

    public int insertYhq(HotelCouponVo yhqVo){
        String namespace = this.getNamespace();
        return getSqlSession().insert(namespace + "insertYhq", yhqVo);
    }

    public HotelCouponVo selectYhqById(int f_hc_id){
        Map<String, Object> map = new HashMap<>();
        map.put("f_hc_id", f_hc_id);
        return getSqlSession().selectOne(this.getNamespace() + "selectYhqById", map);
    }

    public int updateYhqById(HotelCouponVo yhqVo) {
        return getSqlSession().update(this.getNamespace() + "updateYhqById", yhqVo);
    }

    public int deleteYhqContent(int f_hc_id) {
        Map<String, Object> map = new HashMap<>();
        map.put("f_hc_id", f_hc_id);
        return getSqlSession().update(this.getNamespace() + "deleteYhqContent", map);
    }

    public int selectCouponCodeCount(HotelCouponCodeVo hotelCouponCodeVo) {
        return getSqlSession().selectOne(this.getNamespace() + "selectCouponCodeCount", hotelCouponCodeVo);
    }
    public List<HotelCouponCodeVo> selectCouponCodeList(Map<String, Object> map) {
        return getSqlSession().selectList(this.getNamespace() + "selectCouponCodeList", map);
    }

    public int insertCouponCode(HotelCouponCodeVo hotelCouponCodeVo){
        String namespace = this.getNamespace();
        return getSqlSession().insert(namespace + "insertCouponCode", hotelCouponCodeVo);
    }

    public HotelCouponCodeVo selectCouponCodeById(int f_hcc_id){
        return getSqlSession().selectOne(this.getNamespace() + "selectCouponCodeById", f_hcc_id);
    }

    public int updateCouponCode(HotelCouponCodeVo hotelCouponCodeVo) {
        return getSqlSession().update(this.getNamespace() + "updateCouponCode", hotelCouponCodeVo);
    }

    public int deleteCouponCode(int f_hcc_id) {
        return getSqlSession().update(this.getNamespace() + "deleteCouponCode", f_hcc_id);
    }
}
